<?php
namespace app\admin\controller;

use app\common\model\ActionPrepare as ActionPrepareModel;

/**
 * 活动报名控制器
 * Class Action
 * @package app\index\controller
 */
class Actionprepare extends Base
{
    /**
     * [index  活动报名]
     * @return mixed|string
     * @author [C。]
     */
    public function index()
    {
        $param = input('param.');
        $model = new ActionPrepareModel;
        $user = $this->user;
        $this->getPageAndSize($param);
        $map = [];
        try {
            $map['aid'] = $param['aid'];
            $count = $model->getCount($map);
            $allpage = intval(ceil($count / $this->size));//总页面
            $lists = $model->getlist($map, $this->from, $this->size);
            foreach($lists as &$v){
                $v['field'] = unserialize($v['field']);
            }
        } catch (\Exception $e) {
            systembug($e->getMessage(),1,'admin/Actionprepare/index');
            return admin_json(-1, '获取失败' . $e->getMessage());
        }
        writelog('查看报名列表', 0, $user);
        return admin_json(1, '获取成功', [
            'count' => $count,//总记录数
            'allpage' => $allpage,
            'lists' => $lists,
        ]);
    }
}